#define _CRT_SECURE_NO_WARNINGS 1
#include"sort.h"

void Print(int* a, int n)
{
	for (int i = 0; i < n; i++)
	{
		cout << a[i] << " ";
	}
	cout << endl;
}
void func1(int* a, int n)
{
	int begin = 0;
	int end = n - 1;
	//QuickSort(a, begin, end);
	QuickSortNoR(a, begin, end);
}
void func2(int* a, int n)
{
	int* tmp = (int*)malloc(sizeof(int) * n);
	if (tmp == nullptr)
	{
		perror("malloc fail");
		exit(-1);
	}
	int begin = 0, end = n - 1;
	//MergeSort(a, tmp, begin, end);
	MergeSortNoR(a, tmp, n);
	free(tmp);
}
int main()
{
	int a[] = { 6,1,2,14,7,9,3,4,5,10,8,17,12};
	int n = sizeof(a) / sizeof(a[0]);
	//func1(a, n);
	//Print(a, n);
	func2(a, n);
	Print(a, n);
	return 0;
}

